feat: add support for server islands for MDX#12446
feat: add support for server islands for MDX#12446apatel369 wants to merge 3 commits intowithastro:nextfrom
MDX#12446Conversation
|
|
Thanks for starting on this! |
| if (node.type !== 'mdxJsxFlowElement' && node.type !== 'mdxJsxTextElement') return; | ||
|
|
||
| const tagName = node.name; | ||
| if (!tagName || !isComponent(tagName) || !hasClientDirective(node)) return; |
There was a problem hiding this comment.
could removing this condition be why tests are failing? should you instead change the condition to also account for hasServerDeferDirective but otherwise leave in the hasClientDirective check?
There was a problem hiding this comment.
Thanks for reviewing this. Sure I will include hasServerDeferDirective in the existing condition.
|
@ematipico I noticed you have closed tuis PR. What's the plan to fix this issue? |
|
|
|
Sure, I will do that. |
|
Reopened for |
Changes
Closes #12252
Server Islands are not rendering as islands in .mdx files because server islands metadata is not added for JSX components in MDX files.
Even after adding server islands metadata, the issue persists because transform function in vite-plugin-server-islands.ts file runs before server metadata is added in rehype.ts file.
I found that vite-plugin-server-islands.ts is added last in create-vite.ts and has
enforce: 'post'but still transform function is running before the server meta data is added.I am looking for feedback and guidance from Astro contributors on how to fix it.
Testing
TODO
Docs
Not needed